﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACBDP
{
    public class BlankPageViewModel : INotifyPropertyChanged
    {
        public BlankPageViewModel()
        {
            Persons = new ObservableCollection<Person>()
            {
                new Person{FullName="Frank"},
                new Person{FullName="Mike"},
                new Person{FullName="Filip"},
                new Person{FullName="John"},
            };
            SearchText = "My Search Text";
        }
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Notifies listeners that a property value has changed.
        /// </summary>
        /// <param name="propertyName">Name of the property used to notify listeners.  This
        /// value is optional and can be provided automatically when invoked from compilers
        /// that support <see cref="CallerMemberNameAttribute"/>.</param>
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                var e = new PropertyChangedEventArgs(propertyName);
                handler(this, e);

            }
        }
        private ObservableCollection<Person> _Persons;
        public ObservableCollection<Person> Persons
        {
            get { return _Persons; }
            set
            {
                if (_Persons != value)
                {
                    _Persons = value;
                    OnPropertyChanged("Persons");
                }
            }
        }
        
        private String _SearchText;
        public String SearchText
        {
            get { return _SearchText; }
            set
            {
                if (_SearchText != value)
                {
                    _SearchText = value;
                    OnPropertyChanged("SearchText");
                }
            }
        }
    }
}
